// var fbxModelLayer;
// 加载fbx模型
// function loadNC() {
//   if (ncModel) {
//     ncModel.remove()
//   }
//   console.log('fbxModel');

//   var ncModel = map.viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
//     url: 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/niaochao/tileset.json',
//     modelMatrix: Cesium.Matrix4.fromArray([99.99997851108984, -0.0014303493442469062, -0.06554186201714174, 0, 0.001516918725556593, 99.99991275756139, 0.13208398491527618, 0, 0.06553991557442629, -0.13208495074860593, 99.99989129036715, 0, 215326486.30848244, -433955217.8187672, -403650951.78094053, 1]),
//     maximumScreenSpaceError: 0.1,
//   }));
//   var ttModel = map.viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
//     url: 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/tiantan/tileset.json',
//     modelMatrix: Cesium.Matrix4.fromArray([0.9999999455486125, 0.0002692314947957686, 0.00019083284429285974, 0, -0.00026915808966365695, 0.9999998898268104, -0.00038457806655650684, 0, -0.00019093636379613477, 0.00038452668141153445, 0.9999999078412639, 0, -12.001476317178458, 24.169769293628633, 26.70461655082181, 1]),
//     maximumScreenSpaceError: 0.1
//   }));
//   var tamModel = map.viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
//     url: 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/buildmodel/tam/tileset.json',
//     modelMatrix: Cesium.Matrix4.fromArray([999.9999997511106, -0.022310961103443105, -0.0000023667286086492823, 0, 0.02231096110332942, 999.9999997511106, 0.000004769293127537821, 0, 0.0000023666224251428503, -0.000004769345480326592, 1000, 0, 2175566672.2321167, -4384319596.937095, -4066022790.1342854, 1]),
//     maximumScreenSpaceError: 0.1
//   }));
//   // map.viewer.flyTo(tamModel);
// }

function loadFBX(fbxName, url, scale, pos, rotation) {
  var fbxModelLayer = new mars3d.layer.TilesetLayer({
    name: fbxName,
    url: url,
    show: true,
    position: {
      lng: pos[0],
      lat: pos[1],
      alt: pos[2]
    },
    scale: scale,
    maximumScreenSpaceError: 0.001,
    maximumMemoryUsage: 1024,
    dynamicScreenSpaceError: false,
    cullWithChildrenBounds: false,
    skipLevelOfDetail: true,
    preferLeaves: true,
    clampToGround: false,
    luminanceAtZenith: 0.3,
    // flyTo: true
  });
  if (rotation != null) {
    fbxModelLayer.rotation = {
      x: rotation[0],
      y: rotation[1],
      z: rotation[2],
    }
  }
  map.addLayer(fbxModelLayer);
}

setTimeout(function () {
  loadFBX('nc', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/niaochao/tileset.json', 100, [116.390341, 39.991444, -40]);
  loadFBX('tam', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/buildmodel/tam/tileset.json', 1000, [116.391293, 39.907393, -950]);
  loadFBX('tt', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/tiantan/tileset.json', 2, [116.406687, 39.882309, 35]);
  loadFBX('cctv', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/cctv/tileset.json', 1000, [116.457732, 39.913493, -950]);
  loadFBX('jwSoho', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/jwSoho/tileset.json', 1000, [116.452951, 39.904353, -950]);
  loadFBX('pkukxg', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/pkukxg/tileset.json', 1400, [116.308958, 39.987276, -1330]);
  loadFBX('bjfd', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/bjfd/tileset.json', 13000, [116.404147, 39.907491, -12940]);
  loadFBX('grtyc', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/grtyc/tileset.json', 1000, [116.441133, 39.929949, -910]);
  loadFBX('cctvTower', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/cctvTower/tileset.json', 1000, [116.300323, 39.918207, -930]);
  loadFBX('alpkt', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/alpkt/tileset.json', 1000, [116.387954, 40.006573, -930]);
  loadFBX('bts', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/bts/tileset.json', 1000, [116.357163, 39.924301, -950]);
  loadFBX('dfddl', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/dfddl/tileset.json', 1000, [116.410207, 39.908152, -950]);
  loadFBX('dfxdl', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/dfxdl/tileset.json', 1000, [116.406386, 39.908079, -950]);
  loadFBX('dfzn', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/dfzn/tileset.json', 1000, [116.408299, 39.907748, -950]);
  loadFBX('dfzb', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/dfzb/tileset.json', 1000, [116.408271, 39.908371, -950]);
  loadFBX('gg', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/gg/tileset.json', 1000, [116.390838, 39.916257, -950]);
  loadFBX('BJGJFD', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/convert/BJGJFD/tileset.json', 1000, [116.422064, 39.908306, -960]);
  loadFBX('BJKJDXTYG', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/convert/BJKJDXTYG/tileset.json', 1000, [116.356003, 39.989017, -960]);
  loadFBX('BJSJG', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/convert/BJSJG/tileset.json', 1000, [116.203074, 39.945331, -950]);
  loadFBX('BJYTZX', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/convert/BJYTZX/tileset.json', 1000, [116.452967, 39.905895, -950]);
  loadFBX('BJZLG', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/convert/BJZLG/tileset.json', 1000, [116.3379, 39.939381, -950]);
  loadFBX('JDXYFD', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/convert/JDXYFD/tileset.json', 1000, [116.306059, 39.896814, -960]);
  loadFBX('JYDS', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/convert/JYDS/tileset.json', 1000, [116.352759, 39.899239, -960]);
  loadFBX('PGDG', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/convert/PGDG/tileset.json', 1000, [116.380337, 39.990093, -960]);
  loadFBX('RMDHT', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/convert/RMDHT/tileset.json', 9000, [116.387266, 39.903604, -8950],[0 ,0 , 90]);
  loadFBX('RMYXJNB', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/convert/RMYXJNB/tileset.json', 1000, [116.391499, 39.903233, -950]);
  loadFBX('SDJC', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/convert/SDJC/tileset.json', 1000, [116.607605, 40.065606, -950]);
  loadFBX('SLF', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/convert/SLF/tileset.json', 1000, [116.384397, 39.991627, -950]);
  loadFBX('XSJ', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/convert/XSJ/tileset.json', 1000, [116.443568, 39.908239, -950]);
  loadFBX('ZGGJMYZX', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/convert/ZGGJMYZX/tileset.json', 1000, [116.453114, 39.908704, -950]);
  loadFBX('ZGZ', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/convert/ZGZ/tileset.json', 1000, [116.452277, 39.91102, -950]);
  loadFBX('ZHSJT', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/convert/ZHSJT/tileset.json', 1000, [116.315141, 39.908661, -950]);
  loadFBX('ZYM', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/convert/ZYM/tileset.json', 1000, [116.391649, 39.899146, -950]);
  loadFBX('ZYMJL', 'https://wckj2020.obs.cn-south-1.myhuaweicloud.com:443/wckj/pku/modelConvet/convert/ZYMJL/tileset.json', 1000, [116.391706, 39.897929, -950]);

}, 2000);